package com.knife.rockknife4jdemo.dto;

public class SingleResponse<T> {

  private static final long serialVersionUID = 1L;

  private boolean success;

  private String errCode;

  private String errMessage;

  private T data;

  public T getData() {
    return data;
  }

  public boolean isSuccess() {
    return success;
  }

  public void setSuccess(boolean success) {
    this.success = success;
  }

  public String getErrCode() {
    return errCode;
  }

  public void setErrCode(String errCode) {
    this.errCode = errCode;
  }

  public String getErrMessage() {
    return errMessage;
  }

  public void setErrMessage(String errMessage) {
    this.errMessage = errMessage;
  }

  public void setData(T data) {
    this.data = data;
  }



  public static <T> SingleResponse<T> of(T data) {
    SingleResponse<T> response = new SingleResponse<>();
    response.setData(data);
    response.setSuccess(true);
    return response;
  }

}
